<?php
class Job_model extends Model {
	function readByStateAndOccupationId($stateId, $occupationId) {
		$query = $this->db->get('jobs');
		return $query->result();
	}

	function readAll() {
		$query = $this->db->get('jobs');
		return $query->result();
	}

	function read($id) {
		$query = $this->db->getwhere('jobs', array('id' => $id));
		return $query->row();
	}

	function create() {
		$data = array(
			'name' => $this->input->post('name'),
			'description' => $this->input->post('description'),
			'how_to_apply' => $this->input->post('how_to_apply')
		);
		$this->db->insert('jobs', $data);
	}

	function update($id) {
		$data = array(
			'name' => $this->input->post('name'),
			'description' => $this->input->post('description'),
			'how_to_apply' => $this->input->post('how_to_apply')
		);
		$this->db->set('last_modified', 'now()', false);
		$this->db->update('jobs', $data, array('id' => $id));
	}

}
?>
